<h1>FontInfo2</h1>

<p>FontInfo2 describes the mapping of codes for a given character set to the 
glyphs that are drawn to represent the character. It extends the functionality 
provided by FontInfo instruction by adding a language attribute which is support 
to support line-breaking when displaying text in different spoken languages.
This instruction is paired with the DefineFont instruction which contains the 
outlines for all the glyphs used to display the characters in a font.</P>

<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top">type</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">10</td>
<td>Identifies the FontInfo2 instruction when it is encoded. It is encoded 
with the length field as a 16-bit integer (Little-endian byte order).</td>
</tr>

<tr>
<td nowrap valign="top">length</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">6</td>
<td>The length in bytes of the body of the instruction when it is encoded. If the length is greater 
than 62 then this field is set to 0x3F and the length is encoded using the 
extendedLength field. Encoded with the type field as a 16-bit integer.</td>
</tr>

<tr>
<td nowrap valign="top">extendedLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">32</td>
<td>Optional. Contains the length in bytes of the encoded instruction if it is
greater than 62 bytes. If the length is 62 bytes or less then this field is 
omitted.</td>
</tr>

<tr>
<td nowrap valign="top">identifier</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>A unique number that identifies the definition within the Flash file.</td>
</tr>

<tr>
<td nowrap valign="top">nameLength</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>The number of characters in the name of the font.</td>
</tr>

<tr>
<td nowrap valign="top">name</td>
<td nowrap valign="top">String</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The name of the font.</td>
</tr>

<tr>
<td nowrap valign="top">reserved</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">3</td>
<td>Reserved</td>
</tr>

<tr>
<td nowrap valign="top">isSmall</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Are the glyphs drawn to align with pixel boundaries.</td>
</tr>

<tr>
<td nowrap valign="top">isShiftJIS</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Are the character codes encoded using the ShiftJIS character set.</td>
</tr>

<tr>
<td nowrap valign="top">isANSI</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Are the character codes encoded using the ANSI (ASCII) character set.</td>
</tr>

<tr>
<td nowrap valign="top">isItalic</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Whether the font is italicised.</td>
</tr>

<tr>
<td nowrap valign="top">isBold</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Whether the font is bold.</td>
</tr>

<tr>
<td nowrap valign="top">isWideCodes</td>
<td nowrap valign="top">boolean</td>
<td nowrap valign="top" align="right">1</td>
<td>Are the character codes encoded as 16-bit values (true) or 8-bit (false).</td>
</tr>

<tr>
<td nowrap valign="top">language</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>A code identifying the spoken language for a font, either 1 = Latin, 2= Japanese, 
3= Korean, 4 = SimplifiedChinese or 5 = TraditionalChinese. The language code is 
used to assist in determining the position of line breaks in text displayed using the 
font.</td>
</tr>

<tr>
<td nowrap valign="top">codes</td>
<td nowrap valign="top">unsigned int[n]</td>
<td nowrap valign="top" align="right">8 or 16</td>
<td>An array of 8-bits or 16-bit word containing the character codes that each 
glyph in the font definition respresents. The position of the character code 
matches the glyph in the array defined in the DefineFont instruction.</td>
</tr>

</table>

<p>The ANSI character set is used for Latin languages (superceded now by Unicode),
SJIS is used for Japanese language characters and Unicode is used for any character 
set.</p>

<p>The index of each entry in the codes array matches the index in the corresponding 
glyph in font definition (DefineFont), allowing a given character 
code to be mapped to a given glyph.</p>

<p>This instruction allows the font associated with a Flash file to be mapped to 
a font installed on the device where the Flash Player displaying the file is hosted. The 
use of a font from a device is not automatic but is determined by the HTML tag 
option <i>deviceFont</i> which is passed to the Flash Player when it is first 
started. If a device does not support a given font then the glyphs in the font 
definition are used to render the characters.</p>

<p>An important distinction between using the host device to specify the font and 
using the glyphs in a font definition is that the device font is not anti-aliased and 
the rendering is dependent on the host device. The glyphs in an DefineFont 
instruction are anti-aliased and are guaranteed to look identical on every device 
the text is displayed.</p>

<h2>History</h2>

<p>The FontInfo2 instruction is defined as the DefineFontInfo2 data structure
in the Macromedia Flash (SWF) File Format Specification. It was introduced 
in Flash 6. Support for small fonts was added in Flash 7.</p>
